﻿using NewsReaderApp.Helpers;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;
using NewsReader.Helpers;
// The User Control item template is documented at http://go.microsoft.com/fwlink/?LinkId=234236

namespace NewsReaderApp.Views
{
    public sealed partial class LandscapeView : UserControl
    {
        public LandscapeView()
        {
            this.InitializeComponent();
            contentViewHolder.SelectionChanged += contentViewHolder_SelectionChanged;
        }

        private void contentViewHolder_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            var fv = sender as CustomFlipView;
            fv.ActionSelectedItemView(dp =>
                {
                    var view = dp.GetFirstDescendantOfType<ScrollViewer>();
                    if (view != null)
                    {
                        view.ScrollToVerticalOffset(0);
                    }
                });
        }

        private void TextBlock_Holding_1(object sender, HoldingRoutedEventArgs e)
        {

        }
    }
}
